<template>
    <div>
        <a-modal
            v-model:visible="visible"
            :title="currentData.fsxmc"
            width="100%"
            wrapClassName="full-modal-planProduction-production"
            :maskClosable="false"
            :destroyOnClose="true"
            :forceRender="true"
        >
            <a-spin size="large" :spinning="spinning" :key="spinningKey">
                <div class="reviewVerificationManage-allHandlingPage-modal-v">
                    <div class="top-handle-v">
                        <div style="font-weight: 600;font-family: KaiTi !important;color: #38f;display: flex;align-items: center;">
                            <!-- {{ currentData.fhjmc }} -->
                            <div>
                                <span style="display: inline-block;border:2px solid #ff9200;padding: 0 5px;border-radius: 17.3px;color: #ff9200;margin-right: 10px;font-size: 18px;">{{ currentData.fhjmc }}</span>
                                <span>{{ currentData.fqymc }}</span>
                            </div>
                            <span v-if="currentData.fslbh" style="display: inline-block;border:2px solid #4eef66;padding: 0 5px;border-radius: 17.3px;color: #4eef66;margin-left: 10px;font-size: 14px;">{{ currentData.fslbh }}</span>
                        </div>
                        <div style="display: flex;align-items: center;">
                            <div style="display: flex;align-items: center;">
                                <a-button style="margin-left: 10px;" class="blue-btn" type="primary" @click="linkHandling('spcysubmitFlow')" icon="edit">提交</a-button>
                                <a-button style="margin-left: 10px;" @click="returnPreviousLink('spcyreturnUpperFlowJob')" icon="rollback">退回</a-button>
                                <a-button style="margin-left: 10px;" type="primary" @click="applicationInfoClick()" icon="file-text" ghost >申请信息</a-button>
                            </div>
                            <div style="display: flex;align-items: center;margin-left: 50px;">
                                <a-button class="blue-btn" type="primary" @click="refreshClick()" icon="reload">刷新</a-button>
                            </div>
                        </div>
                        
                    </div>
                    <!-- <div style="height: 53px;"></div> -->
                    <div style="width: 100%;display: flex;margin-top: 8px">
                        <!-- <div style="height: calc(100vh - 70px);width: 140px;background-color: #fff;padding: 10px;">
                            <commpStep :parameterData="{index:currentData.fhjmc == '方案制定'?2:(currentData.fhjmc == '方案审核'?3:4)}"></commpStep>
                        </div> -->
                        <!-- style="width: calc(100% - 150px);margin-left: 10px;" -->
                        <div style="width: 100%;">
                            <examination
                            ref="examinationRef" 
                            @reviseClick="reviseClick" 
                            @completeAndCorrectChange="completeAndCorrectClick"
                            @returnPreviousLink="returnPreviousLink"
                            @interfaceSuccessful="interfaceSuccessful"
                            @linkHandling="linkHandling"
                            />
                        </div>
                        
                    </div>
                </div>
            </a-spin>
            <processingConditionsAll ref="processingConditionsAllRef" :processingData="processingData" @interfaceSuccessful="interfaceSuccessful"></processingConditionsAll>
            <supplementaryRectification ref="supplementaryRectificationRef" @rectificationSuccess="rectificationSuccess"/>
            <supplementaryHistory ref="supplementaryHistoryRef"/>
            <!-- <materialComparison ref="materialComparisonRef" @modifySuccess="modifySuccess"/> -->
        </a-modal>
    </div>
</template>
<script>
import examination from './examination.vue'
// import materialComparison from './materialComparison.vue'
export default {
    components:{
        examination,
        // materialComparison,
    },
    props:{

    },
    data(){
        return{
            visible:false,
            spinning:false,
            processingData:{},
            currentData:{},
            spinningKey:null,
        }
    },
    watch:{

    },
    mounted(){
        
    },
    methods:{
        getData(row){
            this.cancelLoading()
            this.currentData = row
            this.$nextTick(()=>{
                this.$refs.examinationRef.getData(row)
            })
            
        },
        modifySuccess(){
            //console.log('我在刷新了2')
            this.$refs.examinationRef.getData({...this.currentData,noFirstLoad:false})
        },
        returnClick(){//返回
            this.visible = false
        },
        reviseClick(val){
            this.$emit('reviseClick',val)
        },
        refreshClick(){//刷新
            this.$emit('reviseClick',{...this.currentData,noFirstLoad:false})
            this.spinning = true
            this.spinningKey = Date.now()
            this.cancelLoading()
        },
        cancelLoading(){
            let timer = setInterval((val)=>{
                this.spinning = false
                clearInterval(timer);
            },500)
            
        },
        successReturn(val){
            this.visible = val
            this.$emit('successReturn')
        },
        //提交到方案制定
        linkHandling(val){
            this.$refs.processingConditionsAllRef.processingConditionsVisible = true
            let data = {
                interface:val,
                sqsxid:this.currentData.sqsxid,
                nextNodeDbrList:this.currentData.nextNodeDbrList,
                nextNode:this.currentData.nextNode,
                jobid:this.currentData.jobid,
                headerLeftTitle:'提交',
                headerCenterTitle:'药品生产查验--'+this.currentData.fhjmc,
                otherData:{
                    // fscms:'技术审评',
                },
                isBlr:false,
                isNew:true,
            }
            this.processingData = data
            this.$refs.processingConditionsAllRef.getData(data)
        },
        //提交到综合评定
        linkHandlingTwo(val){
            //  
            // let result = this.$refs.planexaminationRef.sceneSubmitClick('技术审评')
            // if(result){
                this.$refs.processingConditionsAllRef.processingConditionsVisible = true
                let data = {
                    interface:val,
                    sqsxid:this.currentData.sqsxid,
                    nextNodeDbrList:this.currentData.nextNodeDbrList,
                    nextNode:'综合评定',
                    jobid:this.currentData.jobid,
                    headerLeftTitle:'提交到综合评定',
                    headerCenterTitle:'药品生产查验--'+this.currentData.fhjmc,
                    isBlr:false,
                    otherData:{
                        // fscms:'技术审评',
                        nextNode:'综合评定',
                    },
                    isNew:true,
                }
                this.processingData = data
                this.$refs.processingConditionsAllRef.getData(data)
            // }

        },
        //退回
        returnPreviousLink(val){
            this.$refs.processingConditionsAllRef.processingConditionsVisible = true
            let data = {
                interface:val,
                sqsxid:this.currentData.sqsxid,
                nextNodeDbrList:this.currentData.nextNodeDbrList,
                nextNode:this.currentData.nextNode,
                jobid:this.currentData.jobid,
                isBlr:false,
                isThhj:true,
                isXyb:false,
                headerLeftTitle:'退回',
                headerCenterTitle:'药品生产查验--'+this.currentData.fhjmc,
                isNew:true,
                NoViewBlr:true,
            }
            this.processingData = data
            this.$refs.processingConditionsAllRef.getData(data)
        },
        //内部转办
        internalTransferClick(val){
            this.$refs.processingConditionsAllRef.processingConditionsVisible = true
            let data = {
                interface:val,
                sqsxid:this.currentData.sqsxid,
                jobid:this.currentData.jobid,
                isBlyj:true,
                isZbxx:false,
                isXyb:false,
                isNbbl:true,
                isBlr:false,
                NoViewBlr:true,
                headerLeftTitle:'内部转办',
                headerCenterTitle:'药品生产查验--'+this.currentData.fhjmc,
            }
            this.processingData = data
            this.$refs.processingConditionsAllRef.getData(data)
        },
        completeAndCorrectClick(val){
            this.$refs.supplementaryRectificationRef.visible = true
            this.$refs.supplementaryRectificationRef.getData(
                {interfaceValue:val,modalTitle:'补齐补正',
                fsqsxid:this.currentData.sqsxid,isTime:true,jobid:this.currentData.jobid,filterTitle:'补充资料通知函',isGetFilter:true
                ,initJk:'initWjinitZzzBqbzFile',fileJk:'initWjgetZzzBqbzFile'},
                {opinion:'fbqbzyj',timeLimit:'fbqbzsx'}
            )
        },
        supplementAndcorrectHistory(val){
            this.$refs.supplementaryHistoryRef.visible = true
            this.$refs.supplementaryHistoryRef.getData({interfaceValue:val,modalTitle:'补齐补正历史',sqsxid:this.currentData.sqsxid,jobid:this.currentData.jobid})
        },
        rectificationSuccess(){//补齐补正成功后
            this.$refs.examinationRef.rectificationSuccess()
        },
        //提交成功后
        interfaceSuccessful(){
            this.successReturn(false)
        },
        //申请信息
        applicationInfoClick(){
            this.$refs.examinationRef.tabPaneChange('申请信息')
            this.$refs.examinationRef.applicationVisible = true
        },
        //材料对比
        materialComparisonClick(){
            this.$refs.materialComparisonRef.getData(this.currentData)
            this.$refs.materialComparisonRef.visible = true
        },
        //退回政务
        returnGovernmentServices(val){
            this.$refs.supplementaryRectificationRef.visible = true
            this.$refs.supplementaryRectificationRef.getData(
                {interfaceValue:val,modalTitle:'退回政务服务',isTextMessage:true,isGetFilter:true,filterTitle:'退回政务通知函',isJssc:true,
                fsqsxid:this.currentData.sqsxid,isTime:false,jobid:this.currentData.jobid,initJk:'initWjinitQycjFile',fileJk:'initWjgetZzzQycjFile'},
                {opinion:'thyy'}
            )
        },
    }
}
</script>
<style lang="less">
.full-modal-planProduction-production {
    .ant-modal-title{
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
  .ant-modal {
    max-width: 100%;
    top: 0;
    padding-bottom: 0;
    margin: 0;
  }
  .ant-modal-content {
    display: flex;
    flex-direction: column;
    height: calc(100vh);
    // background: #fff;
  }
  .ant-modal-body {
    flex: 1;
    background: #f4f7fc !important;
    padding: 0px;
    height: calc(100vh - 50px);
  }
  .ant-modal-footer{
    display: none;
  }
}
</style>